
let db = require('../utils/DB');//数据库
let to = require('../utils/await-to-js');
let { SUCCESS, ERROR } = require('../utils/result');//结果
let { HOST } = require('../utils/CONSTANT');//常量模块

//轮播图
function bannerModel() {
    return async (req, res) => {
        let [err, data] = await to(db.query(`SELECT id,CONCAT(?,coverimg) as coverimg FROM banner `, [HOST]));
        err ? ERROR(res, '轮播图查询失败', err) : SUCCESS(res, data);
    };
}


module.exports = bannerModel;